package cn.waka.sys.admin.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.waka.sys.admin.dao.ScheduleDao;

@Service
public class ScheduleService {
	
	private ScheduleDao scheduleDao;

	@Autowired
	public void setScheduleDao(ScheduleDao scheduleDao) {
		this.scheduleDao = scheduleDao;
	}
	
	public List<Map<String,Object>> getScheduleList(){
		return scheduleDao.getScheduleList();
	}
	
	public Map<String, Object> getSchedule(int id){
		return scheduleDao.getSchedule(id);
	}
	
	public int delete(int schedule_id){
		return scheduleDao.delete(schedule_id);
	}
	
	//保存|修改
	public int save(int schedule_id ,int resource_id,int week_day){
		int rs = 0;
		if(schedule_id>0){
			rs = scheduleDao.update(schedule_id, resource_id, week_day);
		}else{
			rs = scheduleDao.save(resource_id, week_day);
		}
		return rs;
	}
}
